﻿namespace LitTools
{
    /// <summary>
    /// 存档行为抽象类
    /// </summary>
    public abstract class SaveBehaviour
    {
        /// <summary>
        /// 脏标记
        /// </summary>
        public bool IsDirty = false;
        /// <summary>
        /// 行为初始化
        /// </summary>
        public virtual void Init() { }
        /// <summary>
        /// 保存数据
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="data"></param>
        public abstract void SaveData<T>(T data) where T : SaveData<T>, new();
        /// <summary>
        /// 加载数据
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        public abstract T LoadData<T>() where T : SaveData<T>, new();
        /// <summary>
        /// 写入磁盘
        /// </summary>
        public abstract void WriteToDisk();
    }
}